home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / DOSTIPS4.ZIP / DOSCOLOR.TXT < prev    next >
Text File  |  1986-06-28  |  9KB  |  261 lines

  1.                     Four Screens, No Waiting
  2.       (PC Magazine Vol 5 No 11 June 10, 1986 User-to-User)
  3.  
  4.      The color/graphics (CGA) and enhanced graphics (EGA) adapters
  5. allow multiple text-mode display pages.  These extra pages can be used
  6. from within your programs to perform "instant" screen updates.  They
  7. can also be used from within DOS to store screen output you don't want
  8. to lose while running other programs.
  9.      In 80-column text modes, the CGA cards gives you four screen pages
  10. numbered 0-3.  Since nongraphics programs generally use only the active
  11. display page, anything stored on the other display pages will usually
  12. not be overwritten (although certain word processing programs may use
  13. more than one screen page).
  14.      However, there is no convenient way from within DOS to switch
  15. display pages.  You can use the following SCRIPT1 file to create
  16. PAGE.COM.  Be sure to leave a blank line before RCX and hit the Enter
  17. key after each line, especially the last one:
  18.  
  19. A
  20. MOV AL,[005D]
  21. AND AL,4F
  22. SUB AL,37
  23. JNB 010B
  24. ADD AL,37
  25. MOV AH,05
  26. INT 10
  27. INT 20
  28.  
  29. RCX
  30. 11
  31. N PAGE.COM
  32. W
  33. Q
  34.  
  35. Then type:
  36.  
  37. DEBUG < SCRIPT1
  38.  
  39. to create the program.  You invoke PAGE.COM at the DOS prompt by
  40. entering PAGE n, where n is teh single-digit page number.  For the
  41. CGA, n will be a number from 0 to 3 with 0 as the DOS default.
  42.      An additional problem is that if you start to use the extra
  43. display pages under DOS 3.x, you'll notice that the DOS command CLS
  44. does not work quite right.  If you are in a display page other than
  45. page 0, CLS will blank the screen but place the cursor somewhere other
  46. than where it belongs in the upper-left-hand corner.  While it is
  47. possible to write a short assembly language program to clear the
  48. screen in the way you'd like, a better solution may be to patch
  49. COMMAND.COM so that CLS does what it ought to.
  50.      To patch the DOS 3.1 version of COMMAND.COM, use the following
  51. SCRIPT2 file.  Again, be sure to leave a blank line near the end after
  52. the RET, and hit the Enter key after each line:
  53.  
  54.  
  55.  
  56. A 262C
  57. MOV AH,0F
  58. INT 10
  59. MOV CX,AX
  60. MOV AH,02
  61. XOR DX,DX
  62. INT 10
  63. MOV DL,CH
  64. DEC DL
  65. MOV DH,18
  66. XOR CX,CX
  67. MOV AX,0600
  68. MOV BX,0700
  69. INT 10
  70. MOV BX,0
  71. MOV AH,0B
  72. INT 10
  73. RET
  74.  
  75. W
  76. Q
  77.  
  78. Then, to repair your copy (do not use the original!) of COMMAND.COM:
  79.  
  80. DEBUG COMMAND.COM < SCRIPT2
  81.  
  82.      With DOS 3.1, the CLS command will clear 26 lines rather than the
  83. standard 25.  Therefore, if you run a program that uses extra video
  84. pages, which is important if you are using the extra pages provided by
  85. PAGE.COM, you may find the first line of an extra page mysteriously
  86. erased.  To fix this bug, make sure DEBUG and a copy (not the original!)
  87. of DOS 3.1 COMMAND.COM are on the same disk and type:
  88.  
  89. DEBUG COMMAND.COM
  90. E 263B 18
  91. W
  92. Q
  93.  
  94.      In addition, you can customize COMMAND.COM so that CLS will set
  95. the screen to any color.  This will work on both the standard and
  96. enhanced color graphics cards, and on the PC and AT.  If you don't
  97. mind a black border, just use the DEBUG command to edit the DOS 3.1
  98. screen attribute byte:
  99.  
  100. A>DEBUG COMMAND.COM
  101. -E 2642 1E
  102. -W
  103. Writing 4580 bytes
  104. -Q
  105.  
  106. With this patch the screen reverts to bright yellow text on a blue
  107. background whenever you type in CLS.  You will no longer need a small
  108. COM file or ANSI.SYS to run DOS in color.  If you do use ANSI.SYS, the
  109. patch will be overridden.
  110.  
  111.      Use the following patch to change the border colors for DOS 3.1:
  112.  
  113. A>DEBUG COMMAND.COM
  114. -E 2642 1E
  115. -M CS:2632 264E CS:262C
  116. -A 2649
  117. xxxx:2649 MOV BL,01
  118. xxxx:264B MOV AH,0B
  119. xxxx:264D
  120. -W
  121. Writing 5AAA bytes
  122. -Q
  123.  
  124. The before and after CLS addresses for DOS 3.1 are:
  125.  
  126.            Location of     Address of Screen    Address of Border
  127.            CLS Command       Attribute Byte       Attribute Byte
  128.  
  129. Before:     262C-264F            2642
  130.  
  131. After :                          263C                 264A
  132.  
  133.      The border patch won't work on an EGA configured for the high-
  134. resolution 640 by 370 mode; BIOS prevents a border color from being
  135. set in this mode.  It can be set, however, if the standard RGB monitor
  136. is attached.
  137.      If you are using a patched version of COMMAND.COM and are prompted
  138. to insert a disk containing COMMAND.COM in drive A:, you must insert a
  139. disk containing the patched version.
  140.      The two-chracter hex attribute byte stores the foreground as the
  141. rightmost character and the background as the leftmost character.  Pick
  142. a hex number from 0 to F for each, where 0 = black, 1 = blue, 2 = green,
  143. 3 = light blue (cyan), 4 = red, 5 = purple (magenta), 6 = either brown
  144. or yellow depending on your monitor, 7 = grayish white, 8 = dark gray,
  145. 9 = bright blue, A = bright green, B = bright light blue, C = bright
  146. red, D = bright purple, E = bright yellow, and F = overintense white.
  147. So green text on a purple background would be 52, and bright red text
  148. on a light blue background would be 3C.  The border color is obviously
  149. just a single character from the above list.
  150.      SCRIPT2 is for DOS 3.1 only.  To have CLS produce bright yellow
  151. text on a blue background with a red border, change the:
  152.  
  153. MOV BX,0700
  154.  
  155. instruction to:
  156.  
  157. MOV BX,1E00
  158.  
  159. and change the:
  160.  
  161. MOV BX,0
  162.  
  163. instruction to:
  164.  
  165. MOV BX,0004
  166.  
  167.      If you're using DOS 3.0, the only change that needs to be made is
  168. in the first line.  The line:
  169.  
  170. A 262C
  171.  
  172. should be changed to:
  173.  
  174. A 2412
  175.  
  176.      Another alternative is to use PAGER.BAS below to patch DOS 3.1
  177. COMMAND.COM (a copy, not the original!) and create the PAGE.COM
  178. utility at the same time.
  179.  
  180. 100 'PAGER.BAS
  181. 110 OPEN "COMMAND.COM" AS #1 LEN=1:FIELD #1,1 AS D$
  182. 120 FOR A=4284 TO 4286:GET 1,A:V$=V$+D$:NEXT:IF V$="3.1" THEN 140
  183. 130 PRINT "Retry with DOS 3.1 COMMAND.COM on this disk!":CLOSE:END
  184. 140 FOR A=1 TO 35:READ A$:LSET D$=CHR$(VAL("&H"+A$))
  185. 150 PUT #1,A+9516:NEXT:OPEN "PAGE.COM" AS #2 LEN=1:FIELD #2,1 AS D$
  186. 160 FOR A=1 TO 17:READ A$:LSET D$=CHR$(VAL("&H"+A$)):PUT #2:NEXT
  187. 170 CLOSE:PRINT "COMMAND.COM patched and PAGE.COM created.":END
  188. 180 DATA B4,0F,CD,10,89,C1,B4,02,31,D2,CD,10,88,EA,FE,CA,B6,18
  189. 190 DATA 31,C9,B8,00,06,BB,00,07,CD,10,BB,00,00,B4,0B,CD,10
  190. 200 DATA A0,5D,00,24,4F,2C,37,73,02,04,37,B4,05,CD,10,CD,20
  191.  
  192. -----------------------------------------------------------------
  193.                           PC A La Mode
  194.       (PC Magazine Vol 5 No 12 June 24, 1986 User-to-User)
  195.  
  196.      The normal boot routine usually puts systems with color/graphics
  197. adapters into color text mode even if a black-and-white monitor is
  198. attached.  This forces users with black-and-white monitors to use the
  199. DOS MODE BW command to change the mode so that color text can be read
  200. properly.  Because many user programs, such as SideKick, check the
  201. video mode when loading to decide whether or not to use color in their
  202. own direct screen updates, it is important to ensure that this black-
  203. and-white video mode is properly selected before such memory-resident
  204. routines are loaded.
  205.      However, while it's easy to put such a MODE command in an
  206. AUTOEXEC.BAT file, such files can become irritatingly long.  And each
  207. time the system boots it has to grind through the MOD switch.  One way
  208. to avoid this is to make your boot programs set your video mode to
  209. suit your monitor.  To do this, use DEBUG version 2.0 or later to
  210. modify the boot record on a bootable system disk in drive A:.  First,
  211. load DEBUG and type:
  212.  
  213. L 100 0 0 1
  214.  
  215. to load the drive A: boot record.  Then type:
  216.  
  217. U 100 101
  218.  
  219. to display the initial JMP.  You'll see something like JMP 012B.  Write
  220. down the hex number after the JMP.  Then type:
  221.  
  222. A 100
  223.  
  224. to get into DEBUG's miniassembler.  Follow this with:
  225.  
  226. MOV AX,2
  227. INT 10
  228.  
  229. hitting Enter after each.  Then, substituting the number you wrote down
  230. at the beginning of this process for the xxxx, type:
  231.  
  232. JMP xxxx
  233.  
  234. and hit the Enter key twice.  Finally, to make the change permanent:
  235.  
  236. W 100 0 0 1
  237.  
  238. to write it to the disk in drive A:, and then to quit, type:
  239.  
  240. Q
  241.  
  242. Be sure to hit Enter after each line.
  243.      You can use the DOS SYS.COM program to copy this updated boot
  244. record to other disks you use for booting up the system.  This
  245. technique works with all versions of DOS.  The new instructions are
  246. written over the boot program's name, which serves no real function.
  247.      Editor's Note:  Whenever you use DEBUG's Write command, be
  248. extremely careful.  Writing to 0 means drive A:, 1 means drive B:,
  249. and 2 means drive C:.  If you load data off a floppy and write it
  250. back to a hard disk, you can create all sorts of trouble.
  251.      The technique above uses service 0 of BIOS Interrupt H10 to set
  252. the video mode.  You can experiment with this and boot your system
  253. into different modes by changing the MOV AX,2 instruction.  Replacing
  254. the 2 with a 0 or 1 yields 40-width screens (the first in B&W, the
  255. second in color).  An AX of 2 (as above) boots the system up in 80-
  256. width B&W, while 3 yields 80-width color.  A value of 4 gives medium-
  257. resolution color graphics; 5 yields medium-resolution B&W graphics;
  258. 6 sets the high-resolution screen.  A 7 is especially for mono.  Other
  259. high-number modes are for the PCjr and/or the EGA.
  260.  
  261.